package sanrenxing.dayEnd.backRepertoryTotal.dao;


import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import sanrenxing.dayEnd.backRepertoryTotal.domain.FundModel;

import java.util.List;

/**
 * 功能:
 * 编写者：
 * 日期：2021
 * 版本：1.0
 */
public interface FundModelDao {
    /**
     * 根据证券名称删除一行
     *
     * @param seName
     * @return
     */
    @Delete("delete from fundModel where seName=#{seName}")
    public int delete(@Param("seName") String seName);

    /**
     * 分页查询条件
     *
     * @param start
     * @param rows
     * @param condition
     * @return
     */
    @Select("select si.seName,ss.secNum,mm.openPrice as seMarket,mm.closePrice as Qprice,ss.sumMoney as totalMoney,mm.inputDate as tranDate \n" +
            "from securitiesStock ss join marketData mm on ss.seId=mm.seId join financialsecurities si on si.seId=ss.seId")
    public List<FundModel> findByPage(@Param("start") int start, @Param("rows") int rows, @Param("condition") String condition);

    /**
     * 按条件统计记录数
     *
     * @param condition 统计条件
     * @return 条件
     */
    @Select("select count(*) from securitiesStock ss join marketData mm on ss.seId=mm.seId join financialsecurities si on si.seId=ss.seId")
    public int count(@Param("condition") String condition);
}
